import axios from '@/api/client'
const state = {
  permission:[],
  currentPagePermission:''
}

const getters = {

}

const mutations = {
  setPermission(state,data=[]){
    state.permission = data
  },
  setCurrentPagePermission(state,data=''){
    state.currentPagePermission = data
  }
}

const actions = {
  async actionSetPermission({commit},id){
    let options = {
      method:'get',
      url:`/user/getbpermissions/${id}`
    }
    await axios(options).then(({data})=> {
      commit('setPermission',data)
    })
  }
}

const store = {
  namespaced:true,
  state,
  getters,
  mutations,
  actions
}

export default store